import {mapGetters} from 'vuex'
export default{
	// 在刚显示的时候会被调用
	onShow() {
		this.setBadge()
	},
	methods: {
		setBadge(){
			uni.setTabBarBadge({
				index:2,
				text:this.checkTotalCount +'' // 必须是字符串
			})
		}
	},
	computed:{
		...mapGetters('m_cart',['total','checkTotalCount'])
	},
	watch:{
		checkTotalCount:{
			handler(newval){
				this.setBadge()
			},
			immediate:true
		}
	}
}